﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ZLCMS.Data.Model;
using ZLCMS.Business.DwzFrame;
using ZLCMS.Business.Util;
using System.Collections.Generic;
using NHibernate;
using ZLCMS.Business;
using NHibernate.Criterion;

namespace ZLCMS.Web.SystemManage.Weixin
{
    public partial class WordMenuHelpInfo : System.Web.UI.Page
    {
        protected FrameHelper _framePage;

        protected string _menuStr;

        protected string _userAccount;

        protected void Page_Load(object sender, EventArgs e)
        {
            _userAccount = UserKit.GetUserAccountFailLogin();

            //初始化DWZ控件
            _framePage = new FrameHelper(this);

            //初始化全局变量值
            InitializeGlobalValue();

            //初始化控件值
            InitializeContent();
        }

        protected void InitializeGlobalValue()
        {
            using (ISession session = DotNet.Common.NHibernateUtil.SessionFactoryHelper.CreateSession())
            {
                try
                {
                    IList<WxResponseRule> ruleList = session.CreateCriteria<WxResponseRule>().Add(Expression.Eq("OwnerAccount", _userAccount)).Add(Expression.Eq("IsAvailable", "1")).Add(Expression.Eq("Kind", "MENU")).AddOrder(Order.Asc("RequestKeyword")).List<WxResponseRule>();
                    _menuStr = null;

                    foreach (WxResponseRule item in ruleList)
                    {
                        _menuStr += item.RequestKeyword + " " + item.RuleTitle + "\n";
                    }
                    tb_content.Text = _menuStr;
                }
                catch (System.Exception ex)
                {
                    _framePage.Alert(new ReturnCode() { statusCode = 300, message = "操作出错-" + ex.Message });
                    return;
                }
            }
        }

        protected void InitializeContent()
        {
            //页面控件数据

            //页面控件值
            if (!IsPostBack)
            {
            }
        }
    }
}
